package com.jh.paymentchannel.repository;

import cn.jh.common.pay.jdpush.OrderStatus;
import com.jh.paymentchannel.payment.TradeStatus;
import com.jh.paymentchannel.pojo.TaiwanCardOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;


@Repository
public interface TaiwanCardOrderRepository extends JpaRepository<TaiwanCardOrder, Long>,
        JpaSpecificationExecutor<TaiwanCardOrder> {

    TaiwanCardOrder findByOrderNo (String orderNo);

    @Query("select t from TaiwanCardOrder t where t.tradeStatus=:tradeStatus and t.createTime<=:createTime")
    List<TaiwanCardOrder> findByTradeStatusAndCreateTime(@Param("tradeStatus")TradeStatus tradeStatus,
                                                         @Param("createTime")Date createTime);


}
